/**
 * Do stuff when loading the add user form
 * @return bool
 */
function loadForm() {
	if (document.add_user.Login) {
		document.add_user.Login.focus();
		}
	return true;
	}

/**
 * Validate submission of form
 * @return bool
 */
function validateSubmit() {
	var obj, val;
	var requiredProps = ['Login','FirstName','LastName'];
	var nameProps = ['FirstName','LastName'];
	// validate required fields
	for(var key in requiredProps) {
		obj = document.getElementsByName(requiredProps[key])[0];
		if (typeof(obj.value) !== 'string' || obj.value.length < 1) {
			highlightObject(obj,'Please complete the required field.');
			return false;
			}
		}
	// validate username
	obj = document.getElementsByName('Login')[0];
	if (!isUsername(obj.value)) {
		highlightObject(obj,'Login can consist only of letters and numbers.');
		return false;
		}
	// validate name properties
	for(var key in nameProps) {
		obj = document.getElementsByName(nameProps[key])[0];
		if (!isName(obj.value)) {
			highlightObject(obj,'The field contains illegal characters.');
			return false;
			}
		}
	// If they have not provided a description, provide one based on
	// name.
	var desc = document.add_user.DisplayName;
	if (typeof(desc.value) !== 'string' || desc.value.length < 1) {
		desc.value = document.add_user.FirstName.value + ' ' +
		document.add_user.LastName.value;
		}
	return true;
	}
